<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			var a=["America","Greece","Britain","Canada","China","Egypt"];
			/*
			var s = ["America","Greece","Britain","Canada","China","Egypt"]
			      let re = s.toString().match(/a/gi)
			      console.log('a出现了'+re.length+"次")
				  */
			var sum=0;
			for(var i in a){
				let s=a[i].toUpperCase();
				let index=0;
				while((index=s.indexOf("A",index))>=0){
					sum++;
					index++;//a的长度
				}
			}
			
			document.write(sum)
			
		</script>
	</body>
</html>